import 'package:flutter/material.dart';

class HomeNav extends StatelessWidget {
  const HomeNav({super.key});

  // 导航数据
  static const List navList = [
    {
      'title': '我的房屋',
      'icon': 'assets/images/house_nav_icon@2x.png',
    },
    {
      'title': '我的报修',
      'icon': 'assets/images/repair_nav_icon@2x.png',
    },
    {
      'title': '访客登记',
      'icon': 'assets/images/visitor_nav_icon@2x.png',
    }
  ];

  @override
  Widget build(BuildContext context) {
    return Container(
      padding:
          const EdgeInsets.symmetric(vertical: 20, horizontal: 10), // 增大垂直方向内边距
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(10),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: navList
            .map((item) => Column(
                  children: [
                    // 图标
                    Image.asset(
                      item['icon'],
                      width: 32,
                      height: 32,
                    ),
                    // 间距
                    const SizedBox(height: 8), // 增加图标和文字间的间距
                    // 文本
                    Text(
                      item['title'],
                      style: const TextStyle(
                        fontSize: 14,
                        fontWeight: FontWeight.w500, // 稍微加粗
                      ),
                    )
                  ],
                ))
            .toList(),
      ),
    );
  }
}
